<%-- Copyright (c) 2002 BroadVision, Inc. All rights reserved              --%>
<%-- The product described in this manual may be protected by one or more  --%>
<%-- U.S. and International patents. The BroadVision One-To-One software   --%>
<%-- is covered by U.S. patent 5,710,887.                                  --%>
<%--                                                                       --%>
<%-- TRADEMARKS: BroadVision and the BroadVision logo are registered       --%>
<%-- trademarks, and BroadVision One-To-One is a trademark of BroadVision, --%>
<%-- Inc. IONA and Orbix are trademarks of IONA Technologies, Ltd. RSA,    --%>
<%-- MD5, and RC2 are trademarks of RSA Data Security, Inc. All other      --%>
<%-- trademarks, service marks, and trade names belong to their respective --%>
<%-- owners. BroadVision, Inc. disclaims any proprietary interest in the   --%>
<%-- marks and names of others.                                            --%>
<%--                                                                       --%>


<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>


<c:set var="formBean" value="${emSegmentCategoryEditForm}" />
<c:set var="formBeanMap" value="${formBean.map}" />


<script language="javascript" src="<%=request.getContextPath()%>/mc/js/date.js"></script>

<script language="javascript">
  function doSave(theForm) {
    theForm.categoryName.value = theForm.categoryName.value.replace(/^\s+/g, '').replace(/\s+$/g, '');
    return submitForm(theForm);
  }

  function doCancel(theForm) {
    location ="<html:rewrite page="/em/segment/segmentBrowse.do" />";
    return false;
  }
</script>


<table class="zoneFive" width="100%" border="0" cellspacing="0" cellpadding="0" summary="content area">
  <tr>
    <td valign="top" width="100%">
      <div class="pageTitle">
        <c:choose>
          <c:when test="${formBeanMap.categoryOid == 0}" >
            <bean:message bundle="em" key="em.segment.title.newCategory"/>
          </c:when>
          <c:otherwise>
            <bean:message bundle="em" key="em.segment.title.editCategory"/>
          </c:otherwise>
        </c:choose>
      </div>
      <div class="errorMessage"><html:errors bundle="em"/></div>
      <jsp:include page="/mc/common/pagetab.jsp" flush="true" />
      <html:javascript formName="emSegmentCategoryEditForm" method="submitForm" />

      <html:form action="/em/segment/segmentCategorySave.do">
        <html:hidden property="parentCategoryOid"/> <!-- Only useful for new category. -->
        <html:hidden property="categoryOid"/>

        <div class="pageSubtitle">
          <span class="left">
            <c:choose>
              <c:when test="${formBeanMap.categoryOid == 0}" >
                <bean:message bundle="em" key="em.segment.category.header.create"/>
              </c:when>
              <c:otherwise>
                <bean:message bundle="em" key="em.segment.category.header.edit"/>
              </c:otherwise>
            </c:choose>
          </span>
          <span class="right">&nbsp;</span>
        </div>

        <table class="labelForm" width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td class="label" width="20%">
              <bean:message bundle="em" key="em.segment.category.name"/>:*
            </td>
            <td class="labelField">
              <html:text property="categoryName" size="50"/>
            </td>
          </tr>
        </table>
        <div class="pageButtonWrap" align="right">
          <input type="reset" name="resetBtn" class="inputButton"
            value="<bean:message key='button.reset' bundle="em"/>">
          &nbsp;&nbsp;
          <input type="button" name="cancelBtn" class="inputButton"
            value="<bean:message key='button.cancel' bundle="em"/>" 
            onclick="return doCancel(this.form)">
          <c:set var="lastButtonValue">
            <c:choose>
              <c:when test="${formBeanMap.categoryOid == 0}" >
                <bean:message key='button.save' bundle="em"/>
              </c:when>
              <c:otherwise>
                <bean:message key='button.update' bundle="em"/>
              </c:otherwise>
            </c:choose>
          </c:set>
          <input type="submit" name="saveBtn" class="inputButton"
            value='<c:out value="${lastButtonValue}" />'
            onclick="return doSave(this.form)">
        </div>
      </html:form>
    </td>
  </tr>
</table>